package com.neuedu.mblog.controller;

import com.neuedu.mblog.service.PostService;
import com.neuedu.mblog.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

/**
 * 项目：mblog_java4
 * 创建时间：  2022-01-03   14:46
 * 作者 :jshand
 * 描述 : 查看博客详情
 * http://127.0.0.1/mblog/show/post
 */
@WebServlet(urlPatterns = "/show/post")
public class ShowPostController extends BaseController {


    private UserService userService = new UserService();
    private PostService postService = new PostService();



    /**
     * /show/post?id=1
     * @param request
     * @param response
     * @throws ServletException
     * @throws IOException
     * @throws SQLException
     * @throws ClassNotFoundException
     */
    @Override
    protected void list(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, ClassNotFoundException {

        //需要查询数据

        postService.detail(request);

        //热门文章、最新发布、最新评论
        postService.top(request);



        request.getRequestDispatcher("/WEB-INF/view/front/post/detail.jsp").forward(request,response);

    }
}
